package com.zdsoft.finance.meet.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

import com.zdsoft.framework.core.common.domain.BaseEntity;
import com.zdsoft.framework.core.common.util.ObjectHelper;

/**
 * 会议
 * 
 * @author liuwei
 *
 */
@Entity
@Table(name = "ZDS_MEETING")
public class Meeting extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3304126428111754423L;

	/**
	 * 会议主持人编号
	 */
	@Column(length = 32)
	private String compereId;

	/**
	 * 会议主持人名称
	 */
	@Column(length = 64)
	private String compereName;

	/**
	 * 会议发起人代码
	 */
	@Column(length = 32)
	private String initiatorId;

	/**
	 * 会议发起人名称
	 */
	@Column(length = 64)
	private String initiatorName;

	/**
	 * 是否已开始投票
	 */
	@Column
	private Integer isVote;

	/**
	 * 会议发起时间
	 */
	@Column
	private Long launchDateTime;

	/**
	 * 会议类型
	 */
	@Column(length = 32)
	private String meetType;

	/**
	 * 会议日期
	 */
	@Column
	private Long meetingDate;

	/**
	 * 会议纪要号
	 */
	@Column(length = 32)
	private String meetingMinutesNo;

	/**
	 * 会议名称
	 */
	@Column(length = 64)
	private String meetingName;

	/**
	 * 会议地点
	 */
	@Column(length = 64)
	private String meetingPlace;

	/**
	 * 记录人编号
	 */
	@Column(length = 32)
	private String recorderId;

	/**
	 * 记录人名称
	 */
	@Column(length = 64)
	private String recorderName;

	/**
	 * 状态
	 */
	@Column(length = 10)
	private String state;

	/**
	 * 会议结束时间
	 */
	@Column
	private Long endDateTime;

	/**
	 * 会议议题
	 */
	@Lob
	private String meetingIssue;

	@OneToMany(mappedBy = "meeting")
	@LazyCollection(LazyCollectionOption.TRUE)
	@Cascade({ CascadeType.ALL })
	private List<MeetingProject> meetingProjects;

	public String getCompereId() {
		return compereId;
	}

	public void setCompereId(String compereId) {
		this.compereId = compereId;
	}

	public String getCompereName() {
		return compereName;
	}

	public void setCompereName(String compereName) {
		this.compereName = compereName;
	}

	public String getInitiatorId() {
		return initiatorId;
	}

	public void setInitiatorId(String initiatorId) {
		this.initiatorId = initiatorId;
	}

	public String getInitiatorName() {
		return initiatorName;
	}

	public void setInitiatorName(String initiatorName) {
		this.initiatorName = initiatorName;
	}

	public Integer getIsVote() {
		return isVote;
	}

	public void setIsVote(Integer isVote) {
		this.isVote = isVote;
	}

	public Long getLaunchDateTime() {
		return launchDateTime;
	}

	public void setLaunchDateTime(Long launchDateTime) {
		this.launchDateTime = launchDateTime;
	}

	public String getMeetType() {
		return meetType;
	}

	public void setMeetType(String meetType) {
		this.meetType = meetType;
	}

	public Long getMeetingDate() {
		return meetingDate;
	}

	public void setMeetingDate(Long meetingDate) {
		this.meetingDate = meetingDate;
	}

	public String getMeetingMinutesNo() {
		return meetingMinutesNo;
	}

	public void setMeetingMinutesNo(String meetingMinutesNo) {
		this.meetingMinutesNo = meetingMinutesNo;
	}

	public String getMeetingName() {
		return meetingName;
	}

	public void setMeetingName(String meetingName) {
		this.meetingName = meetingName;
	}

	public String getMeetingPlace() {
		return meetingPlace;
	}

	public void setMeetingPlace(String meetingPlace) {
		this.meetingPlace = meetingPlace;
	}

	public String getRecorderId() {
		return recorderId;
	}

	public void setRecorderId(String recorderId) {
		this.recorderId = recorderId;
	}

	public String getRecorderName() {
		return recorderName;
	}

	public void setRecorderName(String recorderName) {
		this.recorderName = recorderName;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public Long getEndDateTime() {
		return endDateTime;
	}

	public void setEndDateTime(Long endDateTime) {
		this.endDateTime = endDateTime;
	}

	// 排除isDeleted的数据
	public List<MeetingProject> getMeetingProjects() {
		List<MeetingProject> notDeletedProject = new ArrayList<MeetingProject>();
		if (ObjectHelper.isNotEmpty(meetingProjects)) {
			for (MeetingProject meetingProject : meetingProjects) {
				if (!meetingProject.getIsDeleted()) {
					notDeletedProject.add(meetingProject);
				}
			}
		}
		return notDeletedProject;
	}

	public void setMeetingProjects(List<MeetingProject> meetingProjects) {
		this.meetingProjects = meetingProjects;
	}

	public String getMeetingIssue() {
		return meetingIssue;
	}

	public void setMeetingIssue(String meetingIssue) {
		this.meetingIssue = meetingIssue;
	}

}
